/*
 * @Author: yanyanru
 * @Date: 2018-05-10
 * @description: 基金信息
*/
import { apiHttp } from '../../../apiHttp';
import CompanyApi from '../../../../api/company/comFundFirmController.api';
import CostApi from '../../../../api/company/comFundCostController.api';
import CollectApi from '../../../../api/company/comFundCollectController.api';
import LpApi from '../../../../api/company/comFundLpController.api';
import FundApi from '../../../../api/company/comFundController.api';
import { ComFundCostDto, JsonResult, ComFundCollectDto, ComFundLPDto, ComFundDto, ComFundFirmDto } from '../../../../api/Interface';
import { CompanyOtherInfoSearchDto } from '../../../../service/subject/company/companyInterface';
export default {
    // 获取管理公司信息
    getFundCompanyList: async (companyOtherInfoSearchDto: CompanyOtherInfoSearchDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CompanyApi.getComFundFirmPage, companyOtherInfoSearchDto);
        return res;
    },
    // 添加管理公司
    saveCompany: async (comFund: ComFundFirmDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CompanyApi.saveComFundFirm, comFund);
        return res;
    },
    // 修改管理公司
    updateCompany: async (comFund: ComFundFirmDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CompanyApi.updateComFundFirm, comFund);
        return res;
    },
    // 删除管理公司
    deleteCompany: async (companyId: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CompanyApi.deleteComFundFirm, {id: companyId});
        return res;
    },
    // 保存基金信息
    saveFundInfo: async (comFund: ComFundDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(FundApi.saveComFund, comFund);
        return res;
    },
    // 修改基金信息
    updateFundInfo: async (comFund: ComFundDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(FundApi.updateComFund, comFund);
        return res;
    },
    // 获取基金信息
    getFundInfo: async (id: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(FundApi.getComFund, {companyId: id});
        return res;
    }, 
    // 查询lp列表
    getFundLpList: async (companyOtherInfoSearchDto: CompanyOtherInfoSearchDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(LpApi.getComFundLPPage, companyOtherInfoSearchDto);
        return res;
    },
    // 添加lp列表
    saveComFundLp: async (comFundLp: ComFundLPDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(LpApi.saveComFundLP, comFundLp);
        return res;
    },
    // 修改lp列表
    updateComFundLp: async (comFundLp: ComFundLPDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(LpApi.updateComFundLP, comFundLp);
        return res;
    },
    // 删除lp信息
    deleteLp: async (lpid: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(LpApi.deleteComFundLP, {id: lpid});
        return res;
    },
    // 添加募集信息
    saveComFundCollect: async (comFundCollect: ComFundCollectDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CollectApi.saveComFundCollect, comFundCollect);
        return res;
    },
    // 修改募集信息
    updateComFundCollect: async (comFundCollect: ComFundCollectDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CollectApi.updateComFundCollect, comFundCollect);
        return res;
    },
    // 根据工商id获取基金募集信息
    getComFundCollectById: async (id: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CollectApi.getComFundCollect, {companyId: id});
        return res;
    },
    // 添加管理费用
    saveComFundCost: async (comFundCost: ComFundCostDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CostApi.saveComFundCost, comFundCost);
        return res;
    },
    // 修改管理费用
    updateComFundCost: async (comFundCost: ComFundCostDto): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CostApi.updateComFundCost, comFundCost);
        return res;
    },
    // 根据id获取管理费用
    getComFundCostById: async (id: number): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(CostApi.getComFundCost, {companyId: id});
        return res;
    },
};